#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int n,q,a[10005];
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin>>n>>q;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int i=1;i<=q;i++)
	{
		int a1,a2,a3;
		scanf("%d",&a1);
		if(a1==1)
		{
			scanf("%d%d",&a2,&a3);
			a[a2]=a3;
		}
		else 
		{
			scanf("%d",&a2);
			int k=a[a2],x=1;
			for(int i=1;i<=n;i++)
			{
				if(i==a2)continue;
				else if(a[i]<k)x++;
				else if(a[i]==k&&i<a2)x++;
			}
			printf("%d\n",x);
		}
	}
	
	return 0;
}
